Skip to main content

Feret Diameters

The longest and shortest distances between two parallel lines that touch a region of interest.

🎭 Mask options and parameters of getFeret method
🔎 ROI options and parameters of feret accessor

Feret diameters are determined by measuring the minimum and the maximum distances between two parallel tangents that touch the boundary of the region of interest. This measurement is commonly employed for the analysis of shapes and structures in images.

tip

Feret diameters can be defined by the points as if the object was measured by calliper. Therefore its other name, calliper diameter.

Feret output

In ImageJS Feret diameters are a ROI class accessor that return a Feret object:

Property nameDescriptionProperty type
minDiameterminimum diameterFeretDiameter
maxDiametermaximum diameterFeretDiameter
aspectRatioratio between diameter lengthsnumber
const feret = roi.feret;

It can also be a Mask method to calculate its feret's diameters:

const feret = mask.getFeret();
info

Each diameter in itself is also an object which has its own properties:

Property nameDescriptionProperty type
angleAngle between the diameter and a horizontal line in degrees.number
calliperLinesCalliper lines that pass by endpoints of Feret diameters.[[Point, Point], [Point, Point]]
lengthlength of the diameternumber
pointsstart and end points of the diameter[Point, Point]
Implementation

Here's how Feret diameter is implemented in ImageJS:

Finding convex hull points: an algorithm is based on the fact that one of the lines is aligned with one of the convex hull sides. This significantly facilitates Feret's diameter's search. Here, a preexisting convex hull method is implemented.(see convex hull page for more information).

Rotating an object: an object gets rotated parallel to the X-axis. It allows finding tilt angles of the diameters. It also simplifies search for points. After all the data is found, it just gets rotated back by the same angle to get actual result.

Calculating maximum distance between points: the algorithm iterates through each point and looks for the biggest distance between other points of convex hull. For the minimum diameter it also compares it with the previous maximum value and if it is smaller, it becomes new current minimum diameter. For maximum diameter it just calculates the maximum distance between points of convex hull.

Finding caliper lines: First, region's extreme values are found among rotated points. For minimum these are X values, for maximum - Y values. After that, lines can be found rather easily. For minimum caliper lines lines have a common Y coordinate with feret points and they are situated at the extremities of an object, which is also easy to obtain, since the object is rotated. Same process for maximum diameter, but this time, it's an X coordinate which is common.